<template>
	<view class="content">
		<view class="info">
			<view class="title">负责人信息</view>
			<view class="name">
				{{ cun.nickname }}
				<text>{{ cun.mobile }}</text>
			</view>
			<view class="bot">
				<text>{{ cun.address }}</text>
				<view class="btn" @click="zanting" v-if="status== false">暂停权限</view>
				<view class="btn" @click="huifu" v-else>恢复权限</view>
			</view>
		</view>
		<!-- <view class="group">
			<view class="title">所负责人员</view>
			<view class="colmun" v-for="(item,index) in list" :key="index">
				<text>{{item.nickname}}</text>
				<text class="phone">{{item.mobile}}</text>
				<text class="name">{{item.address}}</text>
				<image src="../../../static/right.png" mode=""></image>
			</view>
		</view> -->
	</view>
</template>

<script>
export default {
	data() {
		return {
			cun: {},
			page: 1,
			list: [],
			last_page: 1,
			id: '',
			status:false
		};
	},
	onReachBottom() {
		if (this.last_page - this.page >= 0) {
			this.page++;
			this.loadData();
		}
	},
	onLoad(options) {
		// console.log(decodeURIComponent(options.item))
		console.log(options.item);
		this.id = options.item;
		// this.id = JSON.parse(decodeURIComponent(options.item)).user_id;
		this.loadData(this.id);
		this.loadAddress(this.id);
	},
	methods: {
		zanting() {
			this.$http
				.post('/api/userinfo/auth', {
					status: 'hidden',
					user_id: this.id
				})
				.then(res => {
					this.$u.toast('暂停成功');
					this.status=true
					// uni.navigateBack({
					// 	delta: 1
					// });
				});
				
		},
		huifu() {
			this.$http
				.post('/api/userinfo/auth', {
					status: 'normal',
					user_id: this.id
				})
				.then(res => {
					this.$u.toast('恢复成功');
					this.status=false
					// uni.navigateBack({
					// 	delta: 1
					// });
					
				});
		},
		loadAddress(id) {
			this.$http
				.post('/api/userinfo/getuserinfo', {
					user_id: id
				})
				.then(res => {
					// console.log(res)
					// console.log(res.data.data.user_id)
					this.cun = res.data.data;
				});
		},
		loadData(id) {
			this.$http
				.post('/api/userinfo/kehudetail', {
					page: this.page,
					limit: '35',
					user_id: id
				})
				.then(res => {
					// console.log(res)
					if (this.page == 1) {
						this.list = res.data.data.data;
					} else {
						this.list = this.list.concat(res.data.data.data);
					}
				});
		}
	}
};
</script>

<style lang="scss" scoped>
.content {
	min-height: 100vh;
	background-color: #f8f8f8;
	padding: 30rpx;
	box-sizing: border-box;
}
.info {
	background: rgba(255, 255, 255, 1);
	border-radius: 20px;
	width: 690rpx;
	padding: 20rpx;
	box-sizing: border-box;
	.title {
		font-size: 15px;
		font-family: PingFang SC;
		font-weight: 500;
		color: rgba(102, 102, 102, 1);
		opacity: 0.66;
	}
	.name {
		font-size: 18px;
		font-family: PingFang SC;
		font-weight: bold;
		color: rgba(51, 51, 51, 1);
		margin: 30rpx 0;
		text {
			font-size: 15px;
		}
	}
	.bot {
		display: flex;
		justify-content: space-between;
		align-items: center;
		text {
			font-size: 15px;
			font-family: PingFang SC;
			font-weight: bold;
			color: rgba(51, 51, 51, 1);
		}
		.btn {
			width: 160rpx;
			height: 60rpx;
			background: rgba(2, 213, 144, 1);
			border-radius: 10px;
			line-height: 60rpx;
			text-align: center;
			font-size: 13px;
			font-family: PingFang SC;
			font-weight: 500;
			color: rgba(255, 255, 255, 1);
		}
	}
}
.group {
	padding: 30rpx;
	box-sizing: border-box;
	width: 690rpx;
	background: rgba(255, 255, 255, 1);
	border-radius: 20px;
	margin-top: 30rpx;
	.title {
		font-size: 15px;
		font-family: PingFang SC;
		font-weight: 500;
		color: rgba(102, 102, 102, 1);
		opacity: 0.6;
	}
}
.colmun {
	padding: 30rpx;
	box-sizing: border-box;
	display: flex;
	justify-content: flex-start;
	align-items: center;
	border-bottom: 1px solid rgba(0, 0, 0, 0.05);
	.name {
		margin-right: 15rpx;
	}
	&:last-child {
		border: none;
	}
	text {
		font-size: 17px;
		font-family: PingFang SC;
		font-weight: 500;
		color: rgba(51, 51, 51, 1);
	}
	.phone {
		font-size: 13px;
		font-family: PingFang SC;
		font-weight: 500;
		color: rgba(153, 153, 153, 1);
		flex: 1;
		margin: 0 30rpx;
	}
	image {
		width: 12rpx;
		height: 23rpx;
	}
}
</style>
